from flask import Flask, render_template

app = Flask(import_name=__name__)
app.debug = True


@app.template_global()
def add(a, b):
    return a + b


@app.template_global('current_time')
def get_current_year():
    import datetime
    return datetime.datetime.now()


@app.template_filter('reverse')
def reverse_filter(s):
    return s[::-1]


@app.template_filter()
def filter(x, y, z):
    return x + y + z


@app.route('/', endpoint="index")
def index():
    return render_template('过滤器与标签.html', )


if __name__ == '__main__':
    app.run()
